# Contributor: Fernando Casas Schossow <casasfernando@outlook.com>
# Maintainer: Fernando Casas Schossow <casasfernando@outlook.com>
pkgname=php7-libvirt-php
pkgver=0.5.5
pkgrel=1
pkgdesc="PHP language bindings for Libvirt API. For more details see: http://www.libvirt.org/php/"
url="https://libvirt.org/php/"
arch="all !x86 !armhf !armv7" # segfault on x86, armhf and armv7
license="LGPL-2.1-only"
makedepends="autoconf libvirt-dev libxml2-dev libxml2-utils libxslt php7-dev php7-pecl-imagick libtool linux-headers"
subpackages="$pkgname-doc"
source="https://libvirt.org/sources/php/libvirt-php-$pkgver.tar.gz
	offline-tests.patch
	musl-idn.patch
	musl-fixes.patch"
builddir="$srcdir/libvirt-php-$pkgver"

prepare() {
	default_prepare
	autoconf
}

build() {
	./configure --prefix=/usr
	make
}

check() {
	make check
	php7 --define extension=src/.libs/libvirt-php.so --ri libvirt
}

package() {
	make DESTDIR="$pkgdir" install
	install -D -m644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"
	rm "$pkgdir/usr/lib/php7/modules/libvirt-php.la"
}

sha512sums="2ea263561a0bf5d155314e06dcf3c3b5c278640bc5edfa674cdd777cb6d0810bda0492c6cf77a02bc88fb6aa99b0ff1f0cbaeea87ff2e45bff9b5774a2507684  libvirt-php-0.5.5.tar.gz
a212746438428537422716f5883f6941704137cd2cdceafb965fec8306c81c3bc4a4ce1caf65efc2a033823e8eb6f5afa1b452f9a191c50cd07d4c979e10d5fd  offline-tests.patch
cae4423b361c7735052ae1c1ec4e24090486020d4f3aaf87c16991b9fb90960d90cd8bc392bb017449525fc4567de1080e3d29337b2d756f46edac672b2bd81b  musl-idn.patch
732f22ca206187b7a0ea41fe2d63808c8afc0994f941fbbb933dbde219f597d108aa3ed10b67e074fe90ac6ab571ee0dc70ef725ce8ed746d8f6e4689e972291  musl-fixes.patch"
